<!-- 订单 -->
<template>
  <div>
    <OrderFormNavBar></OrderFormNavBar>
    <van-tabs>
      <van-tab :title="item.name" v-for="(item,key) in title" :key="key"></van-tab>
    </van-tabs>
    <div v-for="(item,index) in lists" :key="index">
      <div>订单编号:{{item.order_no}} {{item.create_at}}</div>
      <div>
        <van-card
          :num="list.number"
          :title="list.goods_title"
          :thumb="list.goods_logo"
          v-for="(list,index) in item.order_goods"
          :key="index"
        >
          <div slot="tags">
            <van-tag plain type="danger">订货编码</van-tag>
            <van-tag plain type="danger">WDF{{list.goods_list_id}}-{{list.goods_id}}</van-tag>
          </div>
          <div slot="tags">
            <van-tag plain>收货人</van-tag>
            <van-tag plain>{{item.receipt.consignee}}-{{item.receipt.phone}}</van-tag>
          </div>
        </van-card>
        <div>总金额:{{item.goods_price}}(含运费{{item.freight_price}})</div>
      </div>
    </div>
  </div>
</template>

<script>
import OrderFormNavBar from "./orderform-component/OrderFormNavBar";
export default {
  name: "OrderForm",

  props: {},

  data() {
    return {
      lists: "",

      title: [
        {
          name: "全部订单",
          num: 0,
          id: 0
        },
        {
          name: "待付款",
          num: 0,
          id: 1
        },
        {
          name: "待收货",
          num: 0,
          id: 2
        }
      ]
    };
  },

  methods: {
    getInfo() {
      let user_id = this.$store.state.user_id;
      this.$http({
        method: "post",
        url: "index/web/myOrder",
        data: {
          user_id,
          page: 1
        }
      })
        .then(res => {
          console.log(res);
          this.lists = res.data.data;
          console.log(this.lists, "这个lists");
        })
        .catch(err => {
          console.log(err);
        });
    }
  },
  created() {
    this.getInfo();
  },
  components: {
    OrderFormNavBar
  }
};
</script>
<style lang='scss' scoped>
</style>